package com.cykj.dto;

/**
 * @BelongsProject: 12306-project
 * @BelongsPackage: com.cykj.dto
 * @Author: 小林
 * @CreateTime: 2024-11-15 11:12
 * @Description: 消息传输对象模型
 * @Version: 1.0
 */
public class ResponseDto {

    private int code;
    private String msg;
    private Object data;

    public ResponseDto(int code, String msg, Object data) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }
    public static ResponseDto success(){
        return new ResponseDto(1, "success",null );
    }
    public static ResponseDto success(Object data){
        return new ResponseDto(1, "success",data);
    }

    public static ResponseDto error(String msg){
        return new ResponseDto(0,msg,null);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


    @Override
    public String toString() {
        return "ResponseDto{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}

